#ifndef __FRAME_PROFILE_H__
#define __FRAME_PROFILE_H__

#ifdef WIN32
#define FRAME_PROFILE_ENABLE
#endif

#ifdef FRAME_PROFILE_ENABLE
#include <vector>
	#define FrameProfileDrawCallBatch(name, triangleCount, vertexCount) FrameProfiler::addDrawCallInfoBatch(name, triangleCount, vertexCount)
	#define FrameProfileDrawCall(name, triangleCount, vertexCount) FrameProfiler::addDrawCallInfo(name, triangleCount, vertexCount)
	#define FrameProfileBegin() FrameProfiler::beginFrame()
	#define FrameProfileEnd() FrameProfiler::endFrame()
	#define FrameProfileDump() FrameProfiler::dumpThisFrame()
#else
	#define FrameProfileDrawCallBatch(name, triangleCount, vertexCount)
	#define FrameProfileDrawCall(name, triangleCount, vertexCount)
	#define FrameProfileBegin()
	#define FrameProfileEnd()
	#define FrameProfileDump()
#endif

#ifdef FRAME_PROFILE_ENABLE
struct SDrawcallInfo
{
	std::string TextureName;
	int	TriangleCount;
	int VertexCount;	
	bool IsBatch;
};

class FrameProfiler
{
public:
	static void beginFrame();
	static void endFrame();

	static void addDrawCallInfoBatch(const char* textureName, int triangleCount, int vertexCount);
	static void addDrawCallInfo(const char* textureName, int triangleCount, int vertexCount);
	static void dumpDrawCallInfo();

	static void dumpThisFrame()
	{
		s_dump = true;
	}

private:
	static std::vector<SDrawcallInfo> s_drawCallInfosBatch;
	static std::vector<SDrawcallInfo> s_drawCallInfos;
	static bool s_dump;

public:
	static bool s_inFlushBatch;

	static int s_maxDrawCall;
	static int s_drawCallFrameCounter;
	static int s_drawCallSum;

};

#endif //FRAME_PROFILE_ENABLE

#endif //__FRAME_PROFILE_H__
